/* eslint-disable */
// @ts-ignore
import request from '@/utils/request';
import { CustomRequestOptions } from '@/interceptors/request';

import * as API from './types';

/** 关闭订单 POST /tourism/client/c/wxpay/closeOrder */
export async function closeOrderUsingPost({
  body,
  options,
}: {
  body: API.BizTicketOrderIdParam;
  options?: CustomRequestOptions;
}) {
  return request<API.CommonResultString_>(
    '/tourism/client/c/wxpay/closeOrder',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 创建支付订单 POST /tourism/client/c/wxpay/createOrder */
export async function createOrderUsingPost({
  body,
  options,
}: {
  body: API.BizTicketOrderIdParam;
  options?: CustomRequestOptions;
}) {
  return request<API.CommonResultMapStringObject_>(
    '/tourism/client/c/wxpay/createOrder',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 获取小程序支付参数 GET /tourism/client/c/wxpay/getPayParams */
export async function getPayParamsUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.getPayParamsUsingGETParams;
  options?: CustomRequestOptions;
}) {
  return request<API.CommonResultMapStringString_>(
    '/tourism/client/c/wxpay/getPayParams',
    {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    }
  );
}

/** 支付结果通知V3 POST /tourism/client/c/wxpay/notifyV3 */
export async function handlePayNotifyV3UsingPost({
  body,
  options,
}: {
  body: string;
  options?: CustomRequestOptions;
}) {
  return request<string>('/tourism/client/c/wxpay/notifyV3', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 查询订单支付状态 GET /tourism/client/c/wxpay/queryOrderStatus */
export async function queryOrderStatusUsingGet({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.queryOrderStatusUsingGETParams;
  options?: CustomRequestOptions;
}) {
  return request<API.CommonResultMapStringObject_>(
    '/tourism/client/c/wxpay/queryOrderStatus',
    {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    }
  );
}

/** 申请退款 POST /tourism/client/c/wxpay/refund */
export async function refundUsingPost({
  body,
  options,
}: {
  body: API.BizTicketOrderIdParam;
  options?: CustomRequestOptions;
}) {
  return request<API.CommonResultString_>('/tourism/client/c/wxpay/refund', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 测试微信支付V3接口 专门用于测试微信支付V3接口连通性 GET /tourism/client/c/wxpay/testV3Api */
export async function testV3ApiUsingGet({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<API.CommonResultMapStringObject_>(
    '/tourism/client/c/wxpay/testV3Api',
    {
      method: 'GET',
      ...(options || {}),
    }
  );
}

/** 验证微信支付配置 用于检查微信支付配置是否有效 POST /tourism/client/c/wxpay/validateConfig */
export async function validateConfigUsingPost({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<API.CommonResultMapStringObject_>(
    '/tourism/client/c/wxpay/validateConfig',
    {
      method: 'POST',
      ...(options || {}),
    }
  );
}
